from django.http import HttpResponse
 #from django.http import HttpResponse
from django.shortcuts import render
from django.shortcuts import render_to_response
from django.template import loader,context,RequestContext
from blog.models import BlogPost
from datetime import datetime

# def hello(request):
    # return HttpResponse("Hello world ! ")

 
def helloWorld(request):
    context          = {}
    context['hello'] = 'Hello World!'
    return render(request, 'hello.html', context)
#构建对象并返回
def archive(request):
	post = BlogPost(title='mocktitle',body='mockbody',timestamp=datetime.now())
	return render_to_response('index.html',{'posts':[post]})

def  list(request):
	# lists = BlogPost.objects.all()
	# t = loader.get_template("list.html")
	# c = RequestContext(request,{'lists':lists})
	# return HttpResponse(t.render(c))
	time = 'now time is :'+datetime.now().strftime("%Y-%m-%d %H:%M:%S")
	return HttpResponse(time)
